<?php
if(!in_array(User::getType(), array('klassetv')))
{
	require ROOT . 'paginas/errors/403.php';
}

require ROOT . 'template/header.php';
echo '<div id="content2">';

require ROOT . 'paginas/poll/class.php';
require ROOT . 'paginas/poll/controller.php';
$poll = new Poll;
$pollController = new pollController;

$action = isset($parameters[1]) ? $parameters[1] : null;

switch($action)
{
	case 'add':
		$pollController->showAddPage();
		break;
	case 'edit':
		$pollController->showEditPage($parameters[2]);
		break;
	case 'delete':
		$pollController->showDeletePage($parameters[2]);
		break;
	case 'results':
		echo '<h1>Poll resultaten</h1><div id="poll"><div><div class="post"><ul>';
		$poll->showPollResults($parameters[2]);
		echo '</ul></div></div></div>';
		break;
	default: #overzicht
		$polls = $poll->getPolls();
		require ROOT . 'paginas/poll/summary.php';
		break;
}

echo '</div>';
require ROOT . 'template/footer.php';